$(function () {
    if (checkFlash()) {
        initVideo();
    } else {
        $("#videojs").html('<a href="https://get.adobe.com/cn/flashplayer/"; class="flashLoadMsg" target="_blank">安装或者启用FLASH播放器</a>');
    }
});

function isIE() { //ie?
    if (!!window.ActiveXObject || "ActiveXObject" in window) {
        return true;
    } else {
        return false;
    }
}

function checkFlash() {
    var flag = false;
    if (isIE()) {
        try {
            var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
            if (swf) {
                flag = true;
            }
        } catch (e) {
        }
    } else {
        try {
            var swf = navigator.plugins['Shockwave Flash'];
            if (swf) {
                flag = true;
            }
        } catch (e) {
        }
    }
    return flag;
}

function initVideo() {
    var player = videojs('my-player', {techOrder: ['flash', 'html5']}, function onPlayerReady() {
        videojs.log('Your player is ready!');

        // In this context, `this` is the player that was created by Video.js.
        this.play();

        // How about an event listener?
        this.on('ended', function () {
            videojs.log('Awww...over so soon?!');
        });
    });
}